package com.wl.lambda;

public class TestLambda01 {
    //静态内部类
    static class Like2 implements Ilike{
        @Override
        public void Lambda() {
            System.out.println("静态内部类--Lambda2");
        }
    }

    public static void main(String[] args) {
        Ilike like = new Like();
        like.Lambda();

        like = new Like2();
        like.Lambda();

        //局部内部类
        class Like3 implements Ilike{
            @Override
            public void Lambda() {
                System.out.println("局部内部类--Lambda3");
            }
        }
        like = new Like3();
        like.Lambda();

        //匿名内部类 没有名称 必须借助接口或者父类
        like = new Ilike() {
            @Override
            public void Lambda() {
                System.out.println("匿名内部类--Lambda4");
            }
        };
        like.Lambda();

        //Lambda
        like = ()->{
            System.out.println("Lambda5");
        };
        like.Lambda();
    }
}

interface Ilike{
    void Lambda();
}
//实现类
class Like implements Ilike{
    @Override
    public void Lambda() {
        System.out.println("Lambda1");
    }
}
